<template>
    <view class="content">
        <image src="../../static/del/1.png" class="bg"></image>
		<view class="wrapper">
			<view class="box">
				<view class="item">
					<view>卡号</view>
					<input type="text" v-model="card_no" placeholder="请输入卡号" class="inp">
				</view>
				<view class="item">
					<view>卡密</view>
					<input type="text" v-model="unit" placeholder="请输入卡密" class="inp">
				</view>
			</view>
			<view class="btn" @click="doSubmit">激活</view>
			
			<view class="tip">
				<u-parse :html="content.content"></u-parse>
			</view>
		</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
				card_no: '',
				unit: '',
                content: {},
            };
        },
        onLoad() {
            this.getContent()
        },
        methods: {
            doSubmit() {
				if (!this.card_no) {
					this.$toast('请输入卡号')
					return
				}
				if (!this.unit) {
					this.$toast('请输入卡密')
					return
				}
				
            	this.$ajax('activate_card', {
                    userToken: this.$getSync('userToken'),
					card_no: this.card_no,//卡号
					unit: this.unit,//卡密
                }).then(ret => {
            		if (ret.status == 0) {
                        this.$toast(ret.message);
						setTimeout(() => {
							this.$backT()
						}, 500)
            		} else {
            			this.$toast(ret.message);
            		}
            	});
            },
			
			getContent() {
				this.$ajax('get_content', {
			        type: 14,
					//3线上咨询服务协议 4上传体检报告温馨提示 5隐私协议 6如何上传体检报告 7极速问诊须知 
					//8体检须知 9体检项目提示 10体检预约温馨提示 11赠送亲友温馨提示 12会员服务协议
					//13购卡订单提示 14激活码开卡提示 15我要挂号须知
			    }).then(ret => {
					if (ret.status == 0) {
			            this.content = ret.data
					} else {
						this.$toast(ret.message);
					}
				});
			},
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #f5f5f5;
    }
	.bg{
		width: 750rpx;
		height: 560rpx;
	}
	.wrapper{
		width: 750rpx;
		padding: 20rpx;
		position: absolute;
		top: 450rpx;
		left: 0;
	}
	.box{
		padding: 0 30rpx;
		background-color: #fff;
		border-radius: 20rpx;
		font-size: 30rpx;
	}
	.item{
		padding: 35rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2rpx solid #e6e6e6;
	}
	.item:last-child{
		border-bottom: none;
	}
	.inp{
		flex: 1;
		text-align: right;
		padding-left: 15rpx;
	}
	.btn{
		font-size: 30rpx;
		color: #fff;
		text-align: center;
		padding: 25rpx;
		margin: 70rpx 0;
		background: #01b8bd;
		border-radius: 50rpx;
	}
	
	.tip{
		font-size: 24rpx;
		color: #4f4f4f;
		line-height: 1.8;
	}
	

</style>
